<template>
  <div class="rent">
    <div class="rent_one">
      <van-icon name="arrow-left" @click="back" />
      <h3>房屋管理</h3>
      <span></span>
    </div>

    <div class="rent_main">
      <dl v-for="(item, index) in rent" :key="index">
        <dt>
          <img :src="'http://47.102.145.189:8009' + item.houseImg" alt="" />
        </dt>
        <dd>
          <p>{{item.title}}</p>
          <p>{{item.desc}}</p>
          <p>{{item.tags[0]}}</p>
          <p>{{item.price}}/月</p>
        </dd>
      </dl>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      rent: [],
    };
  },
  methods: {
    rentlist() {
      this.$http.get("/user/houses").then((res) => {
        console.log(res);
        this.rent = res.data.body;
      });
    },

    //返回上一页
    back() {
      history.back(-1);
    },
  },
  created() {
    this.rentlist();
  },
};
</script>

<style>
.rent {
  width: 100%;
  height: 100%;
}
.rent_one {
  width: 100%;
  height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  font-size: 16px;
  background: #e6e6e6;
}
.rent_main{
  width: 100%;
  height: 100%;
}
.rent_main dl {
  width: 100%;
  height: 130px;
  display: flex;
}
.rent_main dl dt{
  width: 30%;
  height: 90%;
}
.rent_main dl dt img{
  width: 100%;
}
.rent_main dl dd{
  font-size: 16px;
  display: flex;
  flex-direction: column;
  padding: 0 15px;
}
</style>